import request from '@/utils/request';
import { CodeWrapper, Login } from './types/login';

interface Req {
  name: string
  pwd?: string
  clientId?: string
}
interface Res {
  code: number
  msg: string
  data: any
}

export function getLoginCode(data: Req) {
  return request<CodeWrapper>({
    url: '/api/oauth2/doLogin',
    method: 'POST',
    params: data
  }
  )
}

export function getToken(data: {
  code: string
}) {
  return request<Login>({
    url: '/api/auth/login',
    method: 'GET',
    params: data
  })
}
